/*
 * @Author: Jimmy
 * @LastModifiedBy: Jimmy
 * @Date: 2024-04-14 21:08:58
 * @LastEditTime: 2024-07-07 16:09:48
 * @FilePath: /nest_study/web/src/views/operation/online/columns.tsx
 */
import { Button, Flex } from "antd";
import { formateLocalDateTime } from "@/utils";

export const columns = (logout: Function) => [
    {
        title: '编号',
        dataIndex: 'tokenId',
        ellipsis: true
    },
    {
        title: '登录名称',
        dataIndex: 'userName',
        ellipsis: true
    },
    {
        title: 'IP地址',
        dataIndex: 'ipaddr',
        ellipsis: true
    },
    {
        title: '登录地点',
        dataIndex: 'loginLocation',
        ellipsis: true
    },
    {
        title: '操作系统',
        dataIndex: 'os',
        ellipsis: true
    },
    {
        title: '浏览器',
        dataIndex: 'browser',
        ellipsis: true
    },
    {
        title: '登录时间',
        dataIndex: 'loginTime',
        width: 165,
        render: (text: any, _row: any, _index: number) => <p>{formateLocalDateTime(text)}</p>,
    },
    {
        title: '操作',
        dataIndex: 'action',
        width: 100,
        align: "center" as "center",
        fixed: 'right' as 'right',
        render: (_text: any, _row: any, _index: number) => <Flex gap={10} align="center">
            <Button size="small" type="primary" onClick={() => logout(_row)} danger>强制退出</Button>
        </Flex>,
    }
]